<?php

namespace app\common\model;

use think\Model;

class UserprofitLogs extends Model
{
    /**
     * 获取团队收益
     */
    public function getteamprofit(){
//       计算当天时间范围
        $begin = strtotime(date('Y-m-d'). "7:30");
        $endday = strtotime(date('Y-m-d') . "23:59");
        $where = [
            "uid" => cookie('uid'),
            'create_time' => [">=",$begin],
        ];
       $res  = $this->where($where)->select();
       $arr = [];
       foreach ($res as $k=>$v){
           if($v['level']==1){
               $arr['level1'] = $v;
           }
           if($v['level']==2){
               $arr['level2'] = $v;
           }
           if($v['level']==3){
               $arr['level3'] = $v;
           }
       }
        return $arr;
    }
}
